package ssm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;

import ssm.entity.Department;
import ssm.service.DepartmentService;

@Controller
public class DepartmentControl {

	@Autowired
	private DepartmentService departmentService;
	
	
	@RequestMapping(value="/alldepartment",produces="text/html;charset=UTF-8")
	@ResponseBody
	public String allDepartment() {
		List<Department> list = departmentService.allDepartment();
		return JSON.toJSONString(list);
	}
	
}
